/*
 * @lc app=leetcode.cn id=1768 lang=javascript
 *
 * [1768] 交替合并字符串
 */

// @lc code=start
/**
 * @param {string} word1
 * @param {string} word2
 * @return {string}
 */
var mergeAlternately = function (word1, word2) {
  word1 = word1.split('');
  word2 = word2.split('');
  const orther = word1.length < word2.length ?
    word2.splice(word1.length).join('') :
    word1.splice(word2.length).join('');
  let str = '';
  for (let i = 0; i < word1.length; i++) {
    str += word1[i] + word2[i];
  }
  return str + orther;
};
// @lc code=end

